import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;

public class druid {
    public static void main(String[] args) throws Exception {

        // 1. 导入jar包
        // 2. 写入配置文件
        // 3. 读取配置项
        Properties properties = new Properties();
        InputStream resourceAsStream = druid.class.getResourceAsStream("druid/druid-config.properties");
        properties.load(resourceAsStream);
        // 4. 获取数据库连接池
        DataSource dataSource = DruidDataSourceFactory.createDataSource(properties);
        Connection connection = dataSource.getConnection();
        System.out.println(connection);
    }
}
